package com.ouyang.service;

import com.ouyang.dao.oders.OdersDao;
import com.ouyang.dao.oders.OdersDaoImpl;
import com.ouyang.poji.Oders;

import java.util.List;


public class OdersServiceImpl implements OdersService {
    private OdersDao odersDao;

    public OdersServiceImpl ( ) {
        this.odersDao = new OdersDaoImpl();
    }

    @Override
    public List<Oders> getlist () {
        return odersDao.getlist();
    }

    @Override
    public void addoders ( String OrderNumber, String cdbName, String RentPeople ) {
        Integer rs = odersDao.addoders(OrderNumber, cdbName, RentPeople);
        if(rs!=1)throw new RuntimeException("添加订单信息失败");
    }

    @Override
    public void deloders ( Integer id ) {
        Integer rs = odersDao.deloders(id);
        if(rs!=1) throw new RuntimeException("删除订单信息失败");
    }

    @Override
    public void update ( Integer id, String ordernumber, String cdbname, String rentpeople ) {
      Integer rs =  odersDao.update(id,ordernumber,cdbname,rentpeople);
        if(rs!= 1)throw new RuntimeException("修改订单信息失败");
    }

    @Override
    public List<Oders> search ( String key, String value ) {
        return odersDao.search(key,value);
    }
}
